//
//  HPFestivalDetailCell.m
//  HappyPenguin
//
//  Created by zhuangyihang on 1/12/16.
//  Copyright © 2016 zhuangyihang. All rights reserved.
//

#import "HPFestivalDetailCell.h"
#import "UIConstants.h"

@implementation HPFestivalDetailCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.portraitImageView = [UIImageView new];
        [self.contentView addSubview:self.portraitImageView];
        [self.portraitImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.height.equalTo(@40);
            make.centerY.equalTo(self.contentView);
            make.left.equalTo(@15);
        }];
        
        self.portraitImageView.contentMode = UIViewContentModeScaleAspectFill;
        self.portraitImageView.layer.cornerRadius = 20;
        
        self.titleLabel = [UILabel new];
        [self.contentView addSubview:self.titleLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.portraitImageView);
            make.left.equalTo(self.portraitImageView.mas_right).offset(5);
        }];
        self.titleLabel.font = [UIConstants getFont:17];
        self.titleLabel.textColor = [UIConstants getAppColor];
        
        self.detailLabel = [UILabel new];
        [self.contentView addSubview:self.detailLabel];
        [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.portraitImageView);
            make.left.equalTo(self.titleLabel);
        }];
        self.detailLabel.font = [UIConstants getFont:13];
        self.detailLabel.textColor = [UIColor colorWithRGB:0xbababa];
        
        self.dateLabel = [UILabel new];
        [self.contentView addSubview:self.dateLabel];
        [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.titleLabel.mas_right).offset(5);
            make.bottom.equalTo(self.titleLabel);
        }];
        self.dateLabel.textColor = [UIColor colorWithRGB:0xbababa];
        self.dateLabel.font = [UIConstants getFont:13];
        
        self.titleLabel.text = @"习大大";
        self.detailLabel.text = @"145天未消费";
        self.dateLabel.text = @"1999-01-01";
        [self.portraitImageView sd_setImageWithURL:[NSURL URLWithString:@"https://pic2.zhimg.com/2178ec835c7198af83d6b541bb2b9849_m.jpg"]];
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (CGFloat)getCellHeight{
    return 50;
}
@end
